package com.vertx.core.context;

import com.vertx.core.beam.AbstractBeanFactory;
import com.vertx.core.beam.DefaultBeanFactory;
import io.vertx.core.Vertx;

/**
 * 描述:
 * 创建人:hzw
 * 创建时间: 2018/4/17 16:31
 **/
public class AnnotationApplicationContext extends AbstractApplicationContext{


    public AnnotationApplicationContext(String[] packagePaths) throws Exception {
        super(new DefaultBeanFactory(packagePaths), packagePaths);
    }

    public AnnotationApplicationContext(String[] packagePaths, AbstractBeanFactory abstractBeanFactory) throws Exception {
        super(abstractBeanFactory, packagePaths);
        this.packagePaths = packagePaths;
    }


    @Override
    protected void loadBean(Vertx vertx) throws Exception {
        for (Class classes : classSet) {
            if (!beanFactory.assertExistBean(classes)) {
                beanFactory.setClass(classes,vertx);
            }
        }
    }
}
